package com.libmodulemanager

import android.app.Activity
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import com.libui.navigatonbar.NavigationBar
import com.libui.utils.WindowUtils
import com.modulemanager.models.NavigationBarStyle
import com.modulemanager.models.PageConfig
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

/**
 * Instrumented test, which will execute on an Android device.
 *
 * See [testing documentation](http://d.android.com/tools/testing).
 */
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
    @Test
    fun useAppContext() {
        // Context of the app under test.
        val appContext = InstrumentationRegistry.getInstrumentation().targetContext
        assertEquals("com.libmodulemanager.test", appContext.packageName)
    }

    @Test
    fun testWindowUtils() {
        val appContext = InstrumentationRegistry.getInstrumentation().targetContext
        assertEquals(false, WindowUtils.instance.hasNavigationBar(appContext as Activity))
    }

    @Test
    fun testNavigationBar() {
        val appContext = InstrumentationRegistry.getInstrumentation().targetContext
        val navigationBar = NavigationBar(appContext)
        navigationBar.subTitle
        navigationBar.setTitle(null)
        navigationBar.setSubTitle(null)

        val pageConfig = PageConfig.Builder()
            .setName("")
            .setTitle(null)
            .setSubTitle(null)
            .setRightMenus(null)
            .setTitleAlignment(PageConfig.TitleAlignment.CENTER)
            .setNavigationBarStyle(NavigationBarStyle(NavigationBarStyle.NavigationBarType.OPAQUE, null, null))
            .setIcon(null)
            .setSelectedIcon(null)
            .setSelectedIconResId(null)
            .create()

        pageConfig.setTitle("")
        pageConfig.setSubTitle("")
    }
}